package dk.modified.reshary;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.VideoView;

public class CustomVideoView extends VideoView {

	private onPlayStateChangedListener mOnPlayStateChangedListener;

	public CustomVideoView(Context context) {
		super(context);
	}

	public CustomVideoView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public CustomVideoView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public void setOnPlayPauseListener(onPlayStateChangedListener listener) {
		mOnPlayStateChangedListener = listener;
	}

	@Override
	public void stopPlayback() {
		// TODO Auto-generated method stub
		super.stopPlayback();
		if (mOnPlayStateChangedListener != null)
			mOnPlayStateChangedListener.onStopped();
	}

	@Override
	public void start() {
		// TODO Auto-generated method stub
		super.start();
		if (mOnPlayStateChangedListener != null)
			mOnPlayStateChangedListener.onStart();
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		super.pause();
		if (mOnPlayStateChangedListener != null)
			mOnPlayStateChangedListener.onPause();
	}


	interface onPlayStateChangedListener {
		void onStart();
		void onPause();
		void onStopped();
	}

}
